<?php

class ActionManage extends BaseAction
{
    public function run()
    {
        $iPageId = Yii::app()->request->getParam('page_id');
        $oPage   = Page::model()->findByPk($iPageId);

        if ( Yii::app()->request->getIsPostRequest() )
        {
            $oPage->setAttributesFromRequest('Page');
            $oPage->save();
            
            Yii::app()->user->setFlash('page_saved_success', 'Страница обновлена успешно.');
            Yii::app()->controller->redirect(Yii::app()->controller->createUrl('/admin/pages'));
        }

        $this->template->oPage = $oPage;
    }
    
    public function checkboxes()
    {
        return array
        (
            'page_active'
        );
    }
}